package com.lineage.server.command.executor;

import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.S_SkillSound;
import com.lineage.server.serverpackets.ServerBasePacket;
import java.util.StringTokenizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class L1GfxIdInPc implements L1CommandExecutor {
  private static final Log _log = LogFactory.getLog(L1GfxIdInPc.class);
  
  public static L1CommandExecutor getInstance() {
    return new L1GfxIdInPc();
  }
  
  public void execute(L1PcInstance pc, String cmdName, String arg) {
    try {
      StringTokenizer st = new StringTokenizer(arg);
      int gfxid = 0;
      String next = st.nextToken();
      try {
        gfxid = Integer.parseInt(next, 10);
      } catch (Exception e) {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(261));
        return;
      } 
      pc.sendPacketsX8((ServerBasePacket)new S_SkillSound(pc.getId(), gfxid));
    } catch (Exception e2) {
      _log.error("错误的GM指令格式: " + getClass().getSimpleName() + " 执行的GM:" + pc.getName());
      pc.sendPackets((ServerBasePacket)new S_ServerMessage(261));
    } 
  }
}
